From what I have seen in the video tutorials of pygame, the instructor uses a lot of user-defined functions even when he could've avoided. My question is , is that practice not inefficient due to the huge number of function calls? would it not affect the performance?
You must be logged in to post. Please login or register an account.
You could build everything into the main loop, but this would be messy and pretty badly organized. Putting things in functions lets you call upon the functions later again without retyping. Many people actually would separate the files entirely, having the main loop be on py file, and then import a few other side files with functions.
Functions are loaded at the initial loading of the script, as python is read in line by line, so no, performance wouldn't be affected here.
-Harrison 9 years ago
You must be logged in to post. Please login or register an account.